package com.tron.sync.commons;

import net.sourceforge.pinyin4j.PinyinHelper;

import java.util.UUID;

public class TronUtils {
    public static String getPinYinHeadChar(String str) {
        String convert = "";
        for (int j = 0; j < str.length(); j++) {
            char word = str.charAt(j);
            String[] pinyinArray = PinyinHelper.toHanyuPinyinStringArray(word);
            if (pinyinArray != null) {
                convert += pinyinArray[0].charAt(0);
            } else {
                convert += word;
            }
        }
        return convert;
    }

    public static String getUUID() {
        String string = UUID.randomUUID().toString().replace("-","");
        return string.substring(0, 16);
    }
}
